package com.camemax.server.service.impl;

import com.camemax.server.dao.OrdersDao;
import com.camemax.server.pojo.Orders;
import com.camemax.server.service.OrdersService;
import com.camemax.server.utils.MybatisUtils;
import org.springframework.stereotype.Service;

// ************************
// * @Date: 2021/6/21
// * @Author: Camemax
// * @Description: 订单服务实现类 - 实现【订单表写入】、【冗余表备份】以及【订单状态确认更新】业务代码
// ************************
@Service("ordersService")
public class OrdersServiceImpl implements OrdersService {

    // 订单表写入
    @Override
    public int insertOrder(Orders order) {
        return new MybatisUtils().getSqlSession().getMapper(OrdersDao.class).insertOrder(order);
    }
    // 冗余表备份
    @Override
    public int insertRedundancyOrder(Orders order) {
        return new MybatisUtils().getSqlSession().getMapper(OrdersDao.class).insertRedundancyOrder(order);
    }
    // 订单状态确认更新
    @Override
    public int updateRedundancyOrderStatus(String orderId) {
        return new MybatisUtils().getSqlSession().getMapper(OrdersDao.class).updateRedundancyOrderStatus(orderId);
    }
}
